﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApp1.bean
{
    public class scanRecordBean
    {
        private string _id = "";
        public string id
        {
            get { return _id; }

            set { _id = value; }
        }
        private string _scan_string = "";
        public string scan_string
        {
            get { return nonull(_scan_string); }

            set { _scan_string = value; }
        }
        private string _ctime = "";
        public string ctime
        {
            get { return GetDateTime(_ctime); }

            set { _ctime = value; }
        }
        private string _miaoshu = "";
        public string miaoshu
        {
            get { return nonull(_miaoshu); }

            set { _miaoshu = value; }
        }

        private string nonull(string s) { 
            if(s == null)
            {
                return "";
            }
            return s;

        }

        /// <summary>  
            /// 时间戳Timestamp转换成日期  
            /// </summary>  
            /// <param name="timeStamp"></param>  
            /// <returns></returns>  
        private string GetDateTime(string timeStamp)
        {


            if (timeStamp.Length > 10)
            {
                timeStamp = timeStamp.Substring(0, 10);
            }
            DateTime dateTimeStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
            long lTime = long.Parse(timeStamp + "0000000");
            TimeSpan toNow = new TimeSpan(lTime);
            return dateTimeStart.Add(toNow).ToString("yyyy-MM-dd HH:mm:ss");


        }  

    }
}
